<form name="altEditor-form" role="form" id="nodeAfirmaForm" th:object="${nodetsaform}" th:action="@{/savenodeafirma}" method="post">
					
	<input type='hidden' class='primarykey' id="idNode" th:field="*{idNode}">
	
	<div class="form-group">
		<div class="checkbox checkbox-circle checkbox-info peers ai-c cb-center">
			<input type="checkbox" id="active" th:checked="${nodetsaform.active}" class="peer">
				<label for="active" class="peers peer-greed js-sb ai-c">
					<span class="peer peer-greed" th:text="#{form.node.tsa.active}"></span>
				</label>
		</div>
	</div>
	
	<div class="form-group">
		
			<label for="name" class="col-form-label" th:text="#{form.node.tsa.name}"></label>
			<script th:inline="javascript">
				/*<![CDATA[*/
				    var messageName = /*[[#{form.node.name.pattern}]]*/ 'default';
				/*]]>*/
			</script>
			<input onblur="validate(this,messageName);" type="text" id="name" th:field="*{name}" style="overflow:hidden" class="form-control" required pattern=".{3,30}" />
			<div id="invalid-name" class="invalid-feedback" ></div>
		
		<div style="clear:both;"/>
	</div>
	
	<div class="form-group">
		
			<label for="host" class="col-form-label" th:text="#{form.node.tsa.host}"></label>
			<script th:inline="javascript">
				/*<![CDATA[*/
				    var messageHost = /*[[#{form.node.host.pattern}]]*/ 'default';
				/*]]>*/
			</script>
			<input onblur="validate(this,messageHost);" type="text" id="host" th:field="*{host}" style="overflow:hidden" class="form-control" required pattern=".{3,30}"/>
			<div id="invalid-host" class="invalid-feedback" ></div>
		
		<div style="clear:both;"/>
	</div>
	
	<div class="form-group">
		
			<label for="port" class="col-form-label" th:text="#{form.node.tsa.port}"></label>
			<script th:inline="javascript">
				/*<![CDATA[*/
				    var messagePort = /*[[#{form.node.port.pattern}]]*/ 'default';
				/*]]>*/
			</script>
			<input onblur="validate(this,messagePort);" type="text" id="port" th:field="*{port}" style="overflow:hidden" class="form-control" required pattern="[0-9]{1,5}"/>
			<div id="invalid-port" class="invalid-feedback" ></div>
		
		<div style="clear:both;"/>
	</div>

	<div class="form-group">
		<div class="checkbox checkbox-circle checkbox-info peers ai-c cb-center">
			<input type="checkbox" id="isSecure" th:checked="${nodetsaform.isSecure}" class="peer">
				<label for="isSecure" class="peers peer-greed js-sb ai-c">
					<span class="peer peer-greed" th:text="#{form.node.tsa.issecure}"></span>
				</label>
		</div>
	</div>	
		
	<div class="form-group">
		<div class="checkbox checkbox-circle checkbox-info peers ai-c cb-center">
			<input type="checkbox" id="checkEmergencyDB" th:checked="${nodetsaform.checkEmergencyDB}" class="peer">
				<label for="checkEmergencyDB" class="peers peer-greed js-sb ai-c">
					<span class="peer peer-greed" th:text="#{form.node.tsa.checkEmergencyDB}"></span>
				</label>
		</div>
	</div>	
	
	<div class="form-group">
		<div class="checkbox checkbox-circle checkbox-info peers ai-c cb-center">
			<input type="checkbox" id="checkAfirma" th:checked="${nodetsaform.checkAfirma}" class="peer">
				<label for="checkAfirma" class="peers peer-greed js-sb ai-c">
					<span class="peer peer-greed" th:text="#{form.node.tsa.checkAfirma}"></span>
				</label>
		</div>
	</div>
	
	<div class="form-group">
		<div class="checkbox checkbox-circle checkbox-info peers ai-c cb-center">
			<input type="checkbox" id="checkHsm" th:checked="${nodetsaform.checkHsm}" class="peer">
				<label for="checkHsm" class="peers peer-greed js-sb ai-c">
					<span class="peer peer-greed" th:text="#{form.node.tsa.checkHsm}"></span>
				</label>
		</div>
	</div>
	
</form>

<script th:inline="javascript">

	$(document).ready(function () {
		
		// Inicialización con valor correcto del checkbox isSecure
		if ($("#isSecure").is(":checked")) {
	    	$("#isSecure").val('true');
	    } else {
	    	$("#isSecure").attr('value', 'false');
	    }
		
		if ($("#checkEmergencyDB").is(":checked")) {
	    	$("#checkEmergencyDB").val('true');
	    } else {
	    	$("#checkEmergencyDB").attr('value', 'false');
	    }
		
		if ($("#checkAfirma").is(":checked")) {
	    	$("#checkAfirma").val('true');
	    } else {
	    	$("#checkAfirma").attr('value', 'false');
	    }
		
		if ($("#checkHsm").is(":checked")) {
	    	$("#checkHsm").val('true');
	    } else {
	    	$("#checkHsm").attr('value', 'false');
	    }
		
			
	    $("#isSecure").change(function () {
	        if ($(this).is(":checked")) {
	        	$(this).val('true');
	        }
	        else {
	        	$(this).attr('value', 'false');
	        }
	    });
	    
	    $("#checkEmergencyDB").change(function () {
	        if ($(this).is(":checked")) {
	        	$(this).val('true');
	        }
	        else {
	        	$(this).attr('value', 'false');
	        }
	    });
	    
	    $("#checkAfirma").change(function () {
	        if ($(this).is(":checked")) {
	        	$(this).val('true');
	        }
	        else {
	        	$(this).attr('value', 'false');
	        }
	    });
	    
	    $("#checkHsm").change(function () {
	        if ($(this).is(":checked")) {
	        	$(this).val('true');
	        }
	        else {
	        	$(this).attr('value', 'false');
	        }
	    });
	    
	});
	
	function validateSOAP(){
		
		var messageSOAP = /*[[#{form.node.servicecontext.pattern}]]*/ 'default';
		if ($('#serviceContext').val() == '' || ($('#serviceContext').val().length > 50 || $('#serviceContext').val().length < 7)){
			$('#invalid-servicecontext').html(messageSOAP);
			$('#invalid-servicecontext').addClass("invalid-modal");
		}else{
			$('#invalid-servicecontext').html('');
			$('#invalid-servicecontext').removeClass("invalid-modal");
		}
	}
	
	function validateOCSP(){
		
		var messageOCSP = /*[[#{form.node.ocspContext.pattern}]]*/ 'default';
		if ($('#ocspContext').val() == '' || ($('#ocspContext').val().length > 50 || $('#ocspContext').val().length < 7)){
			$('#invalid-ocspservice').html(messageOCSP);
			$('#invalid-ocspservice').addClass("invalid-modal");
		}else{
			$('#invalid-ocspservice').html('');
			$('#invalid-ocspservice').removeClass("invalid-modal");
		}
	}

</script>